<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAppControlTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('app_control', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title',50)->comment('标题');
            $table->string('current_version',20)->comment('当前版本号');
            $table->string('update_to_version',20)->nullable()->comment('更新的目标版本号');
            $table->string('app_name',100)->comment('应用名称');
            $table->string('channel',50)->comment('渠道');
            $table->string('download_url',500)->nullable()->comment('安装包下载地址');
            $table->unsignedTinyInteger('open_weixin_login')->default(0)->comment('是否开启微信登录');
            $table->unsignedTinyInteger('is_update')->default(0)->comment('是否开启更新提示');
            $table->unsignedTinyInteger('force_update')->default(0)->comment('是否开启强制更新提示');
            $table->string('update_words',500)->nullable()->default('')->comment('更新提示语');
            $table->timestamps();
            $table->index(['app_name','current_version','channel']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('app_control');
    }
}
